import { HashRouter, Route, Switch, Redirect } from "react-router-dom";
import Layout from "@layout";
//登录
import Login from "@pages/login/Login.js";
//注册
import Reg from "@pages/reg/Reg.js";
//404
import Nofind from "@layout/nofind/Nofind";
//首页
import Home from "@pages/home/Home";
//预约管理
import Booking from "@pages/booking/Booking";
// 预约挂号
import Registration from "@pages/booking/registration/Registration";
// 预约核酸检测
import Detection from "@pages/booking/detection/Detection";
//消费管理
import Cost from "@pages/cost/Cost";
//门诊消费记录
import CopCost from "@pages/cost/copcost/CopCost";
import Pay from "@pages/cost/pay/Pay";
import Hospital from "@pages/cost/hospital/Hospital";
import HospitalPay from "@pages/cost/hospitalpay/HospitalPay";
import Refund from "@pages/cost/refund/Refund";
// 系统管理
import AdminMag from "@pages/system-set/adminmag/AdminMag"
import RoleMag from "@pages/system-set/rolemag/RoleMag"
import TitleMag from "@pages/system-set/titlemag/TitleMag"
import News from "@pages/system-set/news/News"
import UpPass from "@pages/system-set/uppass/UpPass"

function RouterApp() {
  return (
    <HashRouter>
      <Switch>
        <Route path="/login" component={Login}></Route>
        <Route path="/reg" component={Reg}></Route>
        <Route path="/404" component={Nofind}></Route>
        <Route
          path="/"
          render={() => {
            return (
              <Layout>
                <Switch>
                  <Route exact path="/home" component={Home}></Route>
                  {/* 费用管理 */}
                  <Route exact path="/cost" component={Cost}></Route>
                  {/* 门诊消费记录 */}
                  <Route exact path="/cost/copcost" component={CopCost}></Route>
                  {/* 门诊充值记录 */}
                  <Route exact path="/cost/pay" component={Pay}></Route>
                  {/* 住院消费记录 */}
                  <Route exact path="/cost/hospital" component={Hospital}></Route>
                  {/* 住院充值记录 */}
                  <Route exact path="/cost/hospitalpay" component={HospitalPay}></Route>
                  {/* 退款记录 */}
                  <Route exact path="/cost/refund" component={Refund}></Route>

                  {/* 预约管理 */}
                  <Route exact path="/booking" component={Booking}></Route>
                  {/* 预约挂号 */}
                  <Route exact path="/booking/registration" component={Registration}></Route>
                  {/* 预约核酸检测 */}
                  <Route exact path="/booking/detection" component={Detection}></Route>

                   {/* 系统设置 */}
  
                   <Route exact path="/system-set/adminmag" component={AdminMag}></Route>
                  <Route exact path="/system-set/rolemag" component={RoleMag}></Route>
                  <Route exact path="/system-set/titlemag" component={TitleMag}></Route>
                  <Route exact path="/system-set/news" component={News}></Route>
                  <Route exact path="/system-set/uppass" component={UpPass}></Route>
                  
                  <Redirect exact from="/" to="/home"></Redirect>
                  <Redirect from="" to="/404"></Redirect>
                </Switch>
              </Layout>
            );
          }}
        ></Route>
        
      </Switch>
    </HashRouter>
  );
}

export default RouterApp;
